Skip to content

[docs] Add instructions to recreate a partition index#31362

Open
jaki wants to merge 2 commits into
yugabyte:masterfrom
jaki:docs-recreate-partition-index
Open

[docs] Add instructions to recreate a partition index#31362
jaki wants to merge 2 commits into
yugabyte:masterfrom
jaki:docs-recreate-partition-index

Conversation

@jaki
Copy link
Copy Markdown
Contributor

@jaki jaki commented Apr 30, 2026

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new section to the YSQL documentation titled "Recreate a partition index", providing a step-by-step guide for recreating indexes on partitioned tables online using a detach-and-reattach strategy. The feedback suggests changing the language tag of the example code block from "plpgsql" to "sql" to ensure more accurate syntax highlighting, as the block contains standard SQL statements rather than procedural code.

To recreate indexes, you should avoid directly creating an index on the partitioned table (parent table) because that cannot use `CONCURRENTLY`.
Follow these steps to recreate a partition index online:

```plpgsql
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The code block contains a sequence of standard SQL DDL and DML statements rather than PL/pgSQL procedural code. Using the sql language tag is more appropriate for syntax highlighting in this context.

Suggested change
```plpgsql
```sql

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for infallible-bardeen-164bc9 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 98d7788
🔍 Latest deploy log https://app.netlify.com/projects/infallible-bardeen-164bc9/deploys/69f2c3b90489d8000826a9e9
😎 Deploy Preview https://deploy-preview-31362--infallible-bardeen-164bc9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-project-automation github-project-automation Bot moved this to In progress in Documentation Apr 30, 2026
@jasonyb jasonyb requested a review from aishwarya24 April 30, 2026 03:16
Copy link
Copy Markdown
Collaborator

@aishwarya24 aishwarya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments.

- Parallel writes are expected while creating the index, because concurrent builds for indexes on partitioned tables aren't supported. In this case, it's better to use concurrent builds to create indexes on each partition individually.
- [Row-level geo-partitioning](../../../../../explore/multi-region-deployments/row-level-geo-partitioning/) is being used. In this case, create the index separately on each partition to customize the tablespace in which each index is created.
- `CREATE INDEX CONCURRENTLY` is not supported for partitioned tables (see [CONCURRENTLY](#concurrently)). As a workaround, you can use the [ONLY](#only) keyword to create indexes on child partitions separately, as described in that section.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a link to the "Recreate a partition index" section something like:

  • To rebuild unique indexes on partitions online without running CREATE INDEX CONCURRENTLY on the parent, see Recreate a partition index.

```

Repeat steps 1–9 for `child1`, `child2`, and any other partitions as needed.
Step 4 to lock the parent is optional if there will be no reads or writes against the parent table while the partition is detached.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Step 4 to lock the parent is optional if there will be no reads or writes against the parent table while the partition is detached.


{{< note title="Note" >}}

Step 4 requires object locking support (available since 2025.2): set YB-TServer flags `enable_object_locking_for_table_locks=true` and `ysql_yb_ddl_transaction_block_enabled=true`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Step 4 requires object locking support (available since 2025.2): set YB-TServer flags `enable_object_locking_for_table_locks=true` and `ysql_yb_ddl_transaction_block_enabled=true`.
{{< note title="Note" >}}
Step 4 to lock the parent is optional if there are no reads or writes against the parent table while the partition is detached, and it requires enabling object locking (supported from YugabyteDB {{<release "2025.2">}} or later).
To enable the feature, set the YB-TServer flags `enable_object_locking_for_table_locks=true` and `ysql_yb_ddl_transaction_block_enabled=true`. Refer to Refer to [Enable table-level locks](../../../../../explore/transactions/explicit-locking/#enable-table-level-locks) for more details.
{{< /note >}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants